#pragma once
#include <stdio.h>
#include <string>
#include <vector>

char Value2Ascii(char in);
char Ascii2Value(char in);
bool StringValidCheck(const char * buf, size_t buf_len);
size_t Binary2String(const char * src, size_t src_len,
                     char * des, size_t des_len);
size_t DBstr2Binary(const char * src, size_t src_len,
                    char * des, size_t des_size);


bool SafeCopyString(char* dest, size_t destSize, const char* source);
bool LowerCaseString(char* str, size_t len);
bool UpCaseString(char* str, size_t len);
std::vector<std::string> &StringSplit(const std::string &s, char delim, std::vector<std::string> &elems);
std::vector<int> &StringSplit2Int(const std::string &s, char delim, std::vector<int> &elems);

bool StringSplit2Uid(const std::string &s, uint32_t &uid);

// "format" only support %d,%u,%f,%lf,%e,%p,%lld,%llu,%s,%%
int utf8_snprintf(char* dest, size_t destSize, const char* format, ...);
